﻿namespace MSSqlSchemaDoc.Core.DataStructures
{
    using System.Collections.ObjectModel;
    using System.Xml.Serialization;

    /// <summary>
    /// Represents a foreign key constraint.
    /// </summary>
    public class ForeignKey
    {
        /// <summary>
        /// Gets or sets the name of the constraint.
        /// </summary>
        [XmlAttribute()]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the constraint is disabled.
        /// </summary>
        [XmlElement()]
        public bool IsDisabled { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the constraint is for replication.
        /// </summary>
        [XmlElement()]
        public bool IsNotForReplication { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the constraint is trusted.
        /// </summary>
        [XmlElement()]
        public bool IsNotTrusted { get; set; }

        /// <summary>
        /// Gets or sets the DELETE referential action description.
        /// </summary>
        [XmlElement()]
        public string DeleteReferentialActionDescription { get; set; }

        /// <summary>
        /// Gets or sets the UPDATE referential action description.
        /// </summary>
        [XmlElement()]
        public string UpdateReferentialActionDescription { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the constraint is system named.
        /// </summary>
        [XmlElement()]
        public bool IsSystemNamed { get; set; }

        /// <summary>
        /// Gets or sets the collection of columns participating in the constraint.
        /// </summary>
        [XmlArray()]
        public Collection<ForeignKeyColumnPair> Columns { get; set; }
    }
}
